package main

import (
	"sort"
	"fmt"
)

type ByLength []string


func (s ByLength)Len()int{
	fmt.Println("Len",len(s))
	return len(s)
}

func(s ByLength)Swap(i,j int){
	fmt.Println("Swap,i,j",i,j)
	s[i],s[j]=s[j],s[i]
}

func (s ByLength)Less(i,j int)bool{
	fmt.Println("Less,i,j",i,j)
	return len(s[i])>len(s[j])
}

func main() {
	fruits:=[]string{"prach","banana","kiwi"}

	sort.Sort(ByLength(fruits))

	fmt.Println(fruits)
}
